#ifndef GLOBAL_H
#define GLOBAL_H

#include <QApplication>
#include <QObject>
#include <QFontDatabase>
#include <QTimer>
#include <QEventLoop>
#include <QSettings>
#include <QJsonObject>
#include <QJsonDocument>
#include <QJsonArray>
#include <QDir>
#include <QTextStream>
#include <QTextCodec>
#include <QDate>
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QWebEngineView>

class MGlobal : public QObject
{
    Q_OBJECT
public:
    static MGlobal *fnGetInstance(){
        static MGlobal ObjGlobal;
        return &ObjGlobal;
    }
signals:
    void CallInsidePageAction(QStringList);
};

class Global
{
public:
    Global();
    static QFont IconFont;
    static QStringList apiHost;
    static QString httpInterface;
    static QString apiInterface;
    static QString apiToken;

    static QString aiApiInterface;
    static double aiUnitPrice;

    static QString deepseekApi;
    static QString deepseekApiKey;
    static QString deepseekModel;
    static QString deepseekRoleSystem;

    static QString tencentApi;
    static QString deepseekApiToken;
    static QString tencentSecretId;
    static QString tencentSecretKey;
    static QString tencentModel;

    static QStringList iRedis;
    static QNetworkAccessManager *NetworkManager;
    static QString CompanyName;
    static QString PlatformName;
    static QString fiConfig;
    static QString logdir;
    static QJsonObject usrLoggedInfo;
    static QStringList lstSuperUser;
    static QString strAuthority;
    static QStringList lstAuthority;
    static QJsonObject usrSettingsInfo;

    static QString appClientID;
    static QString appDeviceNumber;
    static QMap<QString, QStringList> DefArea;
    static QJsonArray usrBindDevices;
    static QJsonObject lstDataCache;
    static QMap<QString, QJsonObject> devDataCache;
    static QString hasOptionPasswd;
    static QString CurrDevNumber;
    static QString CurrDevNumberPasswd;
    static QJsonObject CurrDeviceInfo;
    static QString CarouselDevNumber;
    static qint64 devDataListTime;
    static double nFaDianLing;
    static QStringList AlarmItem;
    static QMap<int, QString> AlarmText;
    static QStringList dev2StateText;
    static QString idMqttMessage;

    static QString strCameraIP;
    static QString strCameraUser;
    static QString strCameraPass;
    static int itCameraRtspPort;
    static QString strCameraPath;

    static QString strStreamServer;
    static int strStreamRtspPort;
    static QString strMediaMTXUser;
    static QString itMediaMTXPass;
    static QString strStreamName;

    static void fnInitializationConfig();
    static void fnHttpRequest(QJsonObject httpParameter,
                  QString &errMessage,
                  QString &reqResult,
                  QString url = "");
    static void fnExecSleep(int);
    static void fnWriteConfigSingle(QStringList);
    static void fnSaveOperation(QString);
    static QString fnReadJsFile(const QString &filePath);
    static void fnDataUpdate(QJsonObject, QString &idMqttMessage);
};

#endif // GLOBAL_H
